//
//  LKMessageListCell.m
//  LKIntelligentVideoProject
//
//  Created by RB8 on 2019/2/27.
//  Copyright © 2019年 she1323. All rights reserved.
//

#import "LKMessageListCell.h"

@interface LKMessageListCell()

@property (weak, nonatomic) IBOutlet UIImageView *iconImageView;

@property (weak, nonatomic) IBOutlet UILabel *headerLabel;

@property (weak, nonatomic) IBOutlet UILabel *detailLabel;
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;

@end


@implementation LKMessageListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setModel:(LKMessageListModel *)model{
    _model = model;
    /**
     设备类型
     1.井盖
     2.门禁
     3.监控
     4.机房
     */
    NSString *equipmentName;
    if ([_model.equipmentType isEqual:@"1"]) {
//        self.iconImageView.image = [UIImage imageNamed:@"WechatIMG1"];
//        equipmentName = @"井盖";
    }else if ([_model.equipmentType isEqual:@"2"]){
       self.iconImageView.image = [UIImage imageNamed:@"menjin"];
        equipmentName = @"门禁";
        self.headerLabel.text = _model.sourceName;
        self.detailLabel.text = [NSString stringWithFormat:@"%@的%@设备发生告警消息，告警内容：%@，告警等级：%@，请及时处理",_model.sourceName,equipmentName,_model.eventTypeName,_model.eventLevel];
    }else if ([_model.equipmentType isEqual:@"3"]){
        self.iconImageView.image = [UIImage imageNamed:@"WechatIMG3"];
        equipmentName = @"监控";
        self.headerLabel.text = _model.sourceName;
        self.detailLabel.text = [NSString stringWithFormat:@"%@的%@设备发生告警消息，告警内容：%@，告警等级：%@，请及时处理",_model.sourceName,equipmentName,_model.eventTypeName,_model.eventLevel];
    }else{
        if ([_model.alarmStatus isEqual:@"2"]) {
            self.iconImageView.image = [UIImage imageNamed:@"WechatIMG1"];
        }else{
            self.iconImageView.image = [UIImage imageNamed:@"jinggai"];
        }
        equipmentName = @"井盖";
        self.headerLabel.text = _model.alarmAddr;
       
        self.detailLabel.text = [NSString stringWithFormat:@"%@的%@设备发生告警消息，告警内容：%@，告警等级：%@，请及时处理",_model.alarmAddr,equipmentName, _model.alarmName,_model.eventLevel];
    }

    self.timeLabel.text = [NSString timestampSwitchTime:[_model.createTime integerValue] / 1000 andFormatter:@"yyyy-MM-dd HH:mm:ss"];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
